import 'package:flutter_test/flutter_test.dart';
import 'package:mslocator/mslocator.dart';
import 'package:mslocator/mslocator_platform_interface.dart';
import 'package:mslocator/mslocator_method_channel.dart';
import 'package:plugin_platform_interface/plugin_platform_interface.dart';

class MockMslocatorPlatform
    with MockPlatformInterfaceMixin
    implements MslocatorPlatform {
  @override
  Future<String?> getPlatformVersion() => Future.value('42');

  @override
  Future<String?> getLastKnownPosition() {
    return Future.value("getLastKnownPosition");
  }

  @override
  Future<bool?> checkLocationService() {
    return Future.value(false);
  }
}

void main() {
  final MslocatorPlatform initialPlatform = MslocatorPlatform.instance;

  test('$MethodChannelMslocator is the default instance', () {
    expect(initialPlatform, isInstanceOf<MethodChannelMslocator>());
  });

  test('getPlatformVersion', () async {
    Mslocator mslocatorPlugin = Mslocator();
    MockMslocatorPlatform fakePlatform = MockMslocatorPlatform();
    MslocatorPlatform.instance = fakePlatform;

    expect(await mslocatorPlugin.getPlatformVersion(), '42');
  });
}
